package com.wanmait.hr.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebFilter(filterName = "SysContextFilter")
public class SysContextFilter implements Filter {
    public void destroy() {
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException, IOException {

        SysContext.setRequest((HttpServletRequest) request);
        SysContext.setResponse((HttpServletResponse) response);
        SysContext.cleanContext();
        chain.doFilter(request, response);
        return;
    }

    public void init(FilterConfig config) throws ServletException {

    }

}
